﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using SXFramWork.Core;
using SXFramWork.Model;
namespace SXFramWork.Repository
{
    public class SysUserConfigRepository:RepositoryAbstract<SysUserConfigEntity>, ISysUserConfigRepository
    {
        public SysUserConfigRepository(IDbContext dbContext) : base(dbContext)
        {

        }

        public async Task<SysUserConfigEntity> GetByUserIdAsync(string uid)
        {
            return await FromSql.GetDataAsync("select * from SysUserConfig where SysUserId=@UId", new { UId = uid });
        }

        public async Task<bool> UpdateConfig(string uid, string skin)
        {
            return await FromSql.ExecuteAsync("update SysUserConfig set skin=@skin where sysuserid=@uid", new { uid = uid, skin = skin }) > 0 ? true : false;
        }
    }
}
